import DataColumn from './dataColumn.js'
export default class DataColumnDecimal extends DataColumn {
	constructor(name, numOfDecimals) {
		super(name)
		if (numOfDecimals < 0) {
			alert("无效的小数位数：" + numOfDecimals);
		}
		this.numOfDecimals = numOfDecimals;
		this.displayDecimals = numOfDecimals;
		this.showZero = true;
		
		this.setAlignment("Right");
		this.setDisplayLength(11);
	}
	
	CurrencyType = {
		None:"None",
		//货币，货币符号位在数字前面
		Currency:"Currency",
		//会计专用，货币符号位于单元格最前面
		Account:"Account"
	}
	
	CurrencySymbol = {
		None:"None",
		RMB:"RMB",
		Dollar:"Dollar"
	}
	
	thousandSeperator = true;
	numOfDecimals = 0;
	displayDecimals = 0;
	currencyType = this.CurrencyType.None;
	currencySymbol = this.CurrencySymbol.None;
	percentage = false;
	
	isShowZero() {
		return this.showZero;
	}
	
	setShowZero(showZero) {
		this.showZero = showZero;
	}

	isThousandSeperator() {
		return this.thousandSeperator;
	}
	
	setThousandSeperator(thousandSeperator) {
		this.thousandSeperator = thousandSeperator;
	}

	getNumOfDecimals() {
		return this.numOfDecimals;
	}
	
	setNumOfDecimals(numOfDecimals) {
		this.numOfDecimals = numOfDecimals;
	}

	getDisplayDecimals() {
		return this.displayDecimals;
	}
	
	setDisplayDecimals(displayDecimals) {
		this.displayDecimals = displayDecimals;
	}

	getCurrencyType() {
		return this.currencyType;
	}
	
	setCurrencyType(currencyType) {
		this.currencyType = currencyType;
	}

	getCurrencySymbol() {
		return this.currencySymbol;
	}
	
	setCurrencySymbol(currencySymbol) {
		this.currencySymbol = currencySymbol;
	}

	isPercentage() {
		return this.percentage;
	}

	setPercentage(percentage) {
		this.percentage = percentage;
	}
	
	getDefaultValue() {
		return 0.00;
	}
	
	getDataType() {
		return "TypeDecimal";
	}
}